CPS Recursive Ascent Parsing
نویسنده
چکیده
The parsing problem is ubiquitous in Computer Science. Perhaps that is part of the reason it has been used so frequently to illustrate the power of continuations and monads. It is often the case, though, that the parser examples of continuation passing style and monads are top-down parsers. I intend to show that the continuation passing style of programming naturally leads to bottom-up or recursive ascent parsers. The programming language Scheme will be used to code example parsers.
منابع مشابه
Recursive Ascent-Descent Parsing
Generalized left-corner parsing was originally presented as a technique for generating a parser for the SLR(1) class of grammars but with far fewer states than the SLR(1) parser. This paper modi es and extends the formulation of left-corner parsers so that it is possible to apply the technique to the LALR(1) and LR(1) classes of grammars. It is further shown that left-corner parsers can be conv...
متن کاملScalaBison Recursive Ascent - Descent Parser Generator
ScalaBison is a parser generator accepting bison syntax and generating a parser in Scala. The generated parser uses the idea of “recursive ascent-descent parsing,” that is, directly encoded generalized left-corner parsing. Of interest is that fact that the parser is generated from the LALR(1) tables created by bison, thus enabling extensions such as precedence to be handled implicitly.
متن کاملNon-deterministic Recursive Ascent Parsing
A purely functional implementation of LR-parsers is given, together with a simple correctness proof. It is presented as a generalization of the recursive descent parser. For non-LR grammars the time-complexity of our parser is cubic if the functions that constitute the parser are implemented as memo-functions, i.e. functions that memorize the results of previous invocations. Memo-functions also...
متن کاملConstant time Steepest Ascent Local Search with Statistical Lookahead for NK-Landscapes
A modified form of steepest ascent local search is proposed that displays an average complexity of O(1) time per move for NKLandscape problems. The algorithm uses a Walsh decomposition to identify improving moves. In addition, it is possible to compute a Hamming distance 2 statistical lookahead: if x is the current solution and y is a neighbor of x, it is possible to compute the average evaluat...
متن کاملDirect Left-Recursive Parsing Expression Grammars
Parsing Expression Grammars (PEGs) are specifications of unambiguous recursive-descent style parsers. PEGs incorporate both lexing and parsing phases and have valuable properties, such as being closed under composition. In common with most recursive-descent systems, raw PEGs cannot handle left-recursion; traditional approaches to left-recursion elimination lead to incorrect parses. In this pape...
متن کامل